package cn.stylefeng.guns.modular.business.frequency.ordermodifydetail.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.ordermodifydetail.service.OrderModifyDetailService;
import cn.stylefeng.guns.modular.business.frequency.ordermodifydetail.model.param.OrderModifyDetailParam;

import javax.annotation.Resource;

/**
 * 订单修改记录明细表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderModifyDetailController {

    @Resource
    private OrderModifyDetailService orderModifyDetailService;

    /**
     * 分页查询订单修改记录明细表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderModifyDetail/page")
    @BusinessLog(title = "订单修改记录明细表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderModifyDetailParam orderModifyDetailParam) {
        return new SuccessResponseData(orderModifyDetailService.page(orderModifyDetailParam));
    }

    /**
     * 获取全部订单修改记录明细表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderModifyDetail/list")
    @BusinessLog(title = "订单修改记录明细表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderModifyDetailParam orderModifyDetailParam) {
        return new SuccessResponseData(orderModifyDetailService.list(orderModifyDetailParam));
    }

    /**
     * 查看详情订单修改记录明细表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderModifyDetail/detail")
    @BusinessLog(title = "订单修改记录明细表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderModifyDetailParam.detail.class) OrderModifyDetailParam orderModifyDetailParam) {
        return new SuccessResponseData(orderModifyDetailService.detail(orderModifyDetailParam));
    }

    /**
     * 编辑订单修改记录明细表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderModifyDetail/edit")
    @BusinessLog(title = "订单修改记录明细表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderModifyDetailParam.edit.class) OrderModifyDetailParam orderModifyDetailParam) {
        orderModifyDetailService.edit(orderModifyDetailParam);
        return new SuccessResponseData();
    }


}
